<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>花间村 - 我的订单</title>
    <link rel="stylesheet" href="{{ asset('css/wechat_service_account.css') }}">
</head>

<body>
    <div class="container">
        <h1>我的订单</h1>

        @if ($orders->count() > 0)
            <div class="orders-list">
                @foreach ($orders as $order)
                    <div class="order-item">
                        <div class="order-header">
                            <span>订单号: {{ $order->id }}</span>
                            <span>状态: {{ $order->status }}</span>
                        </div>
                        <div class="order-products">
                            @foreach ($order->products as $product)
                                <div class="product-item">
                                    <span>{{ $product->name }}</span>
                                    <span>¥{{ number_format($product->price, 2) }}</span>
                                </div>
                            @endforeach
                        </div>
                        <div class="order-footer">
                            <span>总价: ¥{{ number_format($order->total_amount, 2) }}</span>
                            <span>下单时间: {{ $order->created_at->format('Y-m-d H:i') }}</span>
                        </div>
                    </div>
                @endforeach
            </div>
        @else
            <p>暂无订单</p>
        @endif

        <a href="{{ route('wechat.service.account.my') }}" class="back-link">返回我的主页</a>
    </div>

    <!-- 载入底部导航栏 -->
    @include('wechat.service_account.components.bottom_nav')
</body>

</html>